package com.kangyi.admin.mapper;

import com.github.pagehelper.Page;
import com.kangyi.admin.annotation.AutoFill;
import com.kangyi.dto.ActivitiesSignupPageQueryDTO;
import com.kangyi.entity.ActivitySignup;
import com.kangyi.enumeration.OperationType;
import com.kangyi.vo.ActivitiesSignupPageQueryVO;
import org.apache.ibatis.annotations.*;

import java.time.LocalDateTime;
import java.util.List;

/**
 * @author Blank
 * @version 1.0
 */
@Mapper
public interface ActivitiesSignupMapper {
    Page<ActivitiesSignupPageQueryVO> pageQuery(@Param("queryDTO") ActivitiesSignupPageQueryDTO activitiesSignupPageQueryDTO,@Param("begin") LocalDateTime begin,@Param("end") LocalDateTime end);

    void deleteActivitySignup(List<Integer> ids);

    @Update("update activity_signup set status = #{status}, update_user = #{updateUser}, update_time = #{updateTime} where id = #{id};")
    @AutoFill(value = OperationType.UPDATE)
    void modifyStatus(ActivitySignup build);

    @Select("select * from activity_signup where id = #{id};")
    ActivitySignup getById(Integer id);

    @Delete("delete from activity_signup where user_id = #{userId};")
    void deleteByUserId(Integer userId);

    @Delete("delete from activity_signup where activity_id = #{id};")
    void deleteByPublicActivityId(Integer id);
}
